package com.neusoft.neu24.nep.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import java.time.OffsetDateTime;

@RestController
@RequestMapping("mqTest1")
public class MqTest1Controller {


    @Autowired
    private StreamBridge streamBridge;


    @RequestMapping
    @ResponseStatus(HttpStatus.ACCEPTED)
    public String sendToBridge() {
        // Publish a timestamp
        final String now = OffsetDateTime.now().toString();
        streamBridge.send("output", now);
        return now;
    }
}
